package com.rabbit.eap.framework.modelMapper.jsr310;

import org.modelmapper.ModelMapper;
import org.modelmapper.Module;

/**
 * @projectName eap
 * @packageName com.rabbit.eap.framework.modelMapper.jsr310
 * @className Jsr310Module
 * @author： rabbit
 * @version： 1.0
 * @since： 2020/5/14 19:51
 * <p>Description: Jsr310Module </p>

 */
public class Jsr310Module implements Module {

    private final Jsr310ModuleConfig config;

    public Jsr310Module() {
        this(new Jsr310ModuleConfig());
    }

    public Jsr310Module(Jsr310ModuleConfig config) {
        this.config = config;
    }

    @Override
    public void setupModule(ModelMapper modelMapper) {
        modelMapper.getConfiguration().getConverters().add(0, new FromTemporalConverter(config));
        modelMapper.getConfiguration().getConverters().add(0, new ToTemporalConverter(config));
        modelMapper.getConfiguration().getConverters().add(0, new TemporalToTemporalConverter());
    }
}

